FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

WORKDIR /src

COPY ["FEShop.AdminWebSite.csproj", "./"]

RUN dotnet restore "./FEShop.AdminWebSite.csproj" \
    --verbosity detailed \
    --disable-parallel \
    --ignore-failed-sources \
    --no-cache

COPY . .

ARG BUILD_CONFIGURATION=Release
RUN dotnet build "FEShop.AdminWebSite.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "FEShop.AdminWebSite.csproj" \
    -c $BUILD_CONFIGURATION \
    -o /app/publish \
    --no-restore  
FROM base AS final
WORKDIR /app
COPY --from=publish --chown=appuser:appuser /app/publish .

ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENTRYPOINT ["dotnet", "FEShop.AdminWebSite.dll"]
